kids encyclopedia robot

Birthday problem facts for kids

Kids Encyclopedia Facts
Birthday Paradox
A chart showing how likely it is for two people to share a birthday as the group grows

The birthday problem (often called the birthday paradox) is an exciting puzzle from probability theory. It asks a simple question: How many random people must be in a room before there is at least a 50% chance that two of them share the exact same birthday?

Most people guess that you need around 180 people, which is about half the days in a standard year. However, the surprising answer is only 23 people!

In mathematics, this is known as a veridical paradox. It is not a true contradiction, but a result that feels completely wrong to our everyday intuition even though it is 100% mathematically true. The secret behind the puzzle is that we are not comparing everyone to you; we are comparing every person to every other person in the room.

Understanding the Birthday Paradox

Why Does Our Intuition Trick Us?

When people hear this question, they usually picture themselves walking into a room full of strangers. They ask: "What are the chances that someone here shares my birthday?"

That is a completely different math problem! To have a 50% chance that someone shares your specific birthday, you would need 253 people in the room.

The birthday paradox is different because it asks if any two people share a date. In a group of 23 people, there are 253 different pairs of people who can compare their birthdays. Because there are so many pairings, the chance of finding a match shoots up very quickly.

Calculating Pairs in a Group

To see why the number of pairs grows so fast, let us count them.

  • If there are 2 people (Person A and Person B), there is only 1 pair: (A, B).
  • If there are 3 people (A, B, and C), there are 3 pairs: (A, B), (A, C), and (B, C).
  • If there are 4 people, there are 6 pairs.

The formula to find the number of unique pairs among n people is:

\text{Number of pairs} = \frac{n \times (n - 1)}{2}

For a group of 23 people:

\text{Number of pairs} = \frac{23 \times 22}{2} = 253

With 253 pairs of people comparing birthdays, finding at least one match becomes much more likely than most people expect!

Who Discovered the Problem?

Mathematicians have explored this puzzle for nearly a century. British mathematician Harold Davenport discussed the problem around 1927. Davenport did not publish it right away because he thought other mathematicians must have already known it.

Austrian mathematician Richard von Mises formally published a version of the birthday problem in 1939. Since then, it has become one of the most famous examples of how probability works.

Step-by-Step Probability Calculation

The Trick: Finding the Opposite Probability

In probability theory, calculating the chances of "at least one match" directly can be complicated. You would have to add up the chances of exactly one match, two matches, three matches, and so on.

A clever mathematical trick is to calculate the probability of the opposite event first.

  • Let Event A be: "Nobody in the room shares a birthday."
  • Let Event B be: "At least two people share a birthday."

Because these two events cover every single possibility, their probabilities must add up to 1 (which means 100%):

P(\text{Match}) = 1 - P(\text{No Match})

If we calculate the chance that everyone has a completely different birthday, we can subtract that number from 1 to find the answer we want.

Walking Through a Room of 23 People

To make the math simple, we make a few standard assumptions:

  • There are 365 days in a standard year (we ignore leap years for now).
  • Every birthday is equally likely throughout the year.
  • There are no twins in the group.

Let us invite 23 people into a room one by one and track the probability that each new person has a unique birthday:

  • Person 1 enters. They can have any birthday. The probability of having a unique birthday is \frac{365}{365} = 1 (100%).
  • Person 2 enters. To avoid matching Person 1, they must have one of the remaining 364 days. The probability is \frac{364}{365}.
  • Person 3 enters. To avoid matching the first two, they must pick one of the 363 remaining days. The probability is \frac{363}{365}.
  • This pattern continues all the way to Person 23, who has 365 - 22 = 343 available days left. The probability is \frac{343}{365}.

To find the probability that all 23 people have different birthdays, we multiply these fractions together:

P(\text{No Match}) = \frac{365}{365} \times \frac{364}{365} \times \frac{363}{365} \times \frac{362}{365} \times \cdots \times \frac{343}{365}

When you multiply all these fractions out, you get:

P(\text{No Match}) \approx 0.4927 \quad (49.27\%)

Now, we subtract this result from 1 to find the probability of a match:

P(\text{Match}) = 1 - 0.4927 = 0.5073 \quad (50.73\%)

Because 50.73% is greater than 50%, a room of 23 people gives you a better-than-even chance of finding a shared birthday!

General Formula for Any Group Size

Birthdaymatch
The graph of no shared birthdays dropping steeply as the group gets bigger

We can write a general formula for any group of n people. The probability that all n birthdays are different is:

\bar{p}(n) = \frac{365 \times 364 \times \cdots \times (365 - n + 1)}{365^n} = \frac{365!}{365^n (365 - n)!}

Here, the exclamation mark (!) represents a factorial, which means multiplying a whole number by every smaller whole number down to 1 (for example, 4! = 4 \times 3 \times 2 \times 1 = 24).

The probability of at least one shared birthday among n people is:

p(n) = 1 - \bar{p}(n)

According to the pigeonhole principle, if you gather 366 people (or 367 in a leap year), the probability of a match becomes 100% because there are more people than available days.

Group Sizes and Their Probabilities

Here is a table showing how quickly the probability of a shared birthday grows as more people join a group:

Number of People (n) Chance of a Shared Birthday (p(n))
1 0.0%
5 2.7%
10 11.7%
20 41.1%
23 50.7%
30 70.6%
40 89.1%
50 97.0%
60 99.4%
70 99.9%
100 99.99997%
366 100.0%

Notice that with just 50 people—such as two average school classrooms combined—there is a 97% chance of a match!

Handy Approximations and Mental Math

Birthday paradox probability
Graph comparing the probability of a match (red) and no match (blue)
Birthday paradox approximation
Graph demonstrating how close mathematical approximations are to the exact values

Using the Exponential Function

Multiplying dozens of large fractions can be slow without a computer. Mathematicians use approximations to get quick estimates.

Using the mathematical constant e (which is approximately 2.718), we can approximate the probability of no match:

\bar{p}(n) \approx e^{-\frac{n(n-1)}{730}}

This gives an approximation for the probability of at least one match:

p(n) \approx 1 - e^{-\frac{n(n-1)}{730}}

For 23 people, this formula gives:

p(23) \approx 1 - e^{-\frac{23 \times 22}{730}} = 1 - e^{-\frac{506}{730}} \approx 1 - 0.499998 = 0.500002

This approximation is remarkably close to the exact value of 50.73%!

Mental Math Rule of Thumb

If you want to estimate the number of people needed for a 50% chance without using a calculator, you can use this handy square root rule:

n \approx \sqrt{2 \times d \times 0.5} = \sqrt{d}

Where d is the number of possibilities (days in a year). For a standard year of 365 days:

n \approx \sqrt{365} \approx 19.1

While 19 is slightly lower than 23, it is a great mental estimate that gets you in the right ballpark instantly.

Real-World Applications and Science

Computer Science: Hash Functions and Birthday Attacks

Birthday attack vs paradox
Comparing matching birthdays in one group to collisions between two sets of data

The birthday paradox is extremely important in computer science and cryptography (the science of keeping digital secrets safe).

Computers frequently use tools called hash functions. A hash function takes a large piece of data (like a password, file, or image) and converts it into a fixed-length string of characters, known as a "hash" or digital fingerprint.

Security systems want every file to have a unique hash. If two completely different files generate the exact same hash, it is called a collision.

Because of the birthday paradox, collisions happen much faster than people think! In cybersecurity, a birthday attack is an exploit where a computer tests random inputs to find matching hashes.

Instead of needing to test all possible combinations (like 2^{64} combinations for a 64-bit key), an attacker only needs to test roughly the square root of that number (about 2^{32}, or roughly 4 billion attempts). Because of this math, computer scientists design hash functions with huge bit sizes (such as 256 bits) to keep systems secure.

Real-World Sports Examples

In the 2014 FIFA World Cup, 32 national teams competed, and each team had a squad of 23 players.

Because each squad had exactly 23 players, probability theory suggested that roughly half of the teams should have a pair of teammates who shared a birthday.

When researchers checked the official rosters, 16 out of the 32 teams had at least one birthday match! Five of those squads (Argentina, France, Iran, South Korea, and Switzerland) even had two separate pairs of matching birthdays. The real-world results matched the mathematical prediction perfectly!

Ecology: Counting Animals in the Wild

Ecologists and wildlife biologists use a related method called mark and recapture to estimate animal populations in lakes and forests.

Scientists capture a sample of animals (like fish), tag them, and release them back into the wild. Later, they capture another group of fish and count how many tagged fish they find. The math used to estimate the total population based on these "matching tags" is directly related to the birthday problem equations.

Fun Variations of the Birthday Problem

Same Birthday as You

Birthday paradox
Comparison showing how many more people are needed to match your specific birthday

What if we change the rules? How many people do you need in a room to have a 50% chance that someone shares your specific birthday?

The formula for matching a specific birthday among n people is:

q(n) = 1 - \left(\frac{364}{365}\right)^n
  • In a room of 23 people, the chance that someone shares your birthday is only about 6.1%.
  • To reach a 50% chance of matching your birthday, you need at least 253 people in the room!

Near Matches: Birthdays Close Together

What if we count "near matches," such as two people born on the same day or just one day apart?

When we widen the window, the number of people needed drops even faster:

  • To have a 50% chance of two birthdays within 1 day of each other, you need only 14 people.
  • To have a 50% chance of two birthdays within 2 days of each other, you need only 11 people.
  • To have a 50% chance of two birthdays within 7 days (one week) of each other, you need only 7 people!

Three or More People Sharing a Birthday

What if you want three or four people to share the exact same birthday?

  • For a 50% chance that 3 people share a birthday, you need a group of 88 people.
  • For a 50% chance that 4 people share a birthday, you need a group of 187 people.

The Coupon Collector's Problem

How many people would you have to survey before you found at least one person born on every single day of the year (all 365 days)?

This is known as the Coupon collector's problem. On average, you would need to ask roughly 2,365 people before every single day on the calendar was covered.

Birthday Paradox on Other Planets

What if humans lived on another planet with a different length of year? The math works for any number of days, which we can call d.

Planet Days in a Year (d) People Needed for 50% Match (n)
Mercury 88 days 12 people
Venus 225 days 19 people
Earth 365 days 23 people
Mars 687 days 32 people
Jupiter 4,333 days 78 people

As the planetary year gets longer, you need more people to find a match, but the number of people needed is always much smaller than the total number of days!

Summary of Key Points

  • The birthday paradox proves that in a group of just 23 people, there is a 50.7% chance that two people share a birthday.
  • It is called a paradox because our intuition compares everyone to ourselves, whereas the math compares all possible pairs.
  • In a group of 23 people, there are 253 pairs of people.
  • With 50 people, the chance of a shared birthday reaches 97%.
  • Computer scientists use this math to study data security and hash function collisions.

Images for kids

kids search engine
Birthday problem Facts for Kids. Kiddle Encyclopedia.